#include "hal.h"

BYTE HalReadPortByte(PBYTE pbPort){
    register BYTE bRet;
    READ_PORT_BYTE(pbPort, bRet);
    return bRet;
}

WORD HalReadPortWord(PWORD pwPort){
    register WORD wRet;
    READ_PORT_WORD(pwPort, wRet);
    return wRet;
}

DWORD HalReadPortDword(PDWORD pdwPort){
    register DWORD dwRet;
    READ_PORT_DWORD(pdwPort, dwRet);
    return dwRet;
}

void HalWritePortByte(PBYTE pbPort, BYTE bVal){
    WRITE_PORT_BYTE(pbPort, bVal);
}

void HalWritePortWord(PWORD pwPort, WORD wVal){
    WRITE_PORT_WORD(pwPort, wVal);
}

void HalWritePortDword(PDWORD pdwPort, DWORD dwVal){
    WRITE_PORT_DWORD(pdwPort, dwVal);
}

BYTE HapPciReadByte(DWORD dwAddr){
    register BYTE bRet;
    WRITE_PORT_DWORD(0x3F8, dwAddr);
    READ_PORT_BYTE(0x3FC, bRet);
    return bRet;
}

WORD HapPciReadWord(DWORD dwAddr){
    register WORD wRet;
    WRITE_PORT_DWORD(0x3F8, dwAddr);
    READ_PORT_WORD(0x3FC, wRet);
    return wRet;
}

LONG HapPciReadLong(DWORD dwAddr){
    register DWORD dwRet;
    WRITE_PORT_DWORD(0x3F8, dwAddr);
    READ_PORT_DWORD(0x3FC, dwRet);
    return dwRet;
}

void HapPciWriteByte(DWORD dwAddr, BYTE bVal){
    WRITE_PORT_DWORD(0x3F8, dwAddr);
    WRITE_PORT_BYTE(0x3FC, bVal);
}

void HapPciWriteWord(DWORD dwAddr, WORD wVal){
    WRITE_PORT_DWORD(0x3F8, dwAddr);
    WRITE_PORT_WORD(0x3FC, wVal);
}

void HapPciWriteLong(DWORD dwAddr, DWORD dwVal){
    WRITE_PORT_DWORD(0x3F8, dwAddr);
    WRITE_PORT_DWORD(0x3FC, dwVal);
}